<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qquickitem.cpp -->
  <title>Item QML 类型 | Qt Quick 5.12.3</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.12</a></td><td ><a href="qtquick-index.html">Qt Quick 模块</a></td><td ><a href="qtquick-qmlmodule.html">QML类型</a></td><td >Item QML 类型</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtquick-index.html">Qt 5.12.3 参考指南</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">目录</a></h3>
<ul>
<li class="level1"><a href="#properties">属性</a></li>
<li class="level1"><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#methods">方法</a></li>
<li class="level1"><a href="#details">详细信息</a></li>
<li class="level2"><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#item-layers">项层</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Item QML 类型</h1>
<span class="subtitle"></span>
<!-- $$$Item-brief -->
<p>一个基本的可视化 QML 类型。 <a href="#details">更多...</a></p>
<!-- @@@Item -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> 导入语句：</td><td class="memItemRight bottomAlign"> import QtQuick 2.12</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Instantiates:</td><td class="memItemRight bottomAlign"> <a href="qml-qtquick-item.html"><a href="qquickitem.html">QQuickItem</a></td></tr><tr><td class="memItemLeft rightAlign topAlign">继承自：</td><td class="memItemRight bottomAlign"> <p><a href="../qtqml/qml-qtqml-qtobject.html">QtObject</a></p>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> 被继承：</td><td class="memItemRight bottomAlign"> <p><a href="qml-qtquick-animatedsprite.html">AnimatedSprite</a>, <a href="qml-qtquick-borderimage.html">BorderImage</a>, <a href="qml-qtquick-canvas.html">Canvas</a>, <a href="qml-qtquick-column.html">Column</a>, <a href="qml-qtquick-layouts-columnlayout.html">ColumnLayout</a>, <a href="qml-qtquick-flickable.html">Flickable</a>, <a href="qml-qtquick-flipable.html">Flipable</a>, <a href="qml-qtquick-flow.html">Flow</a>, <a href="qml-qtquick-focusscope.html">FocusScope</a>, <a href="qml-qtquick-grid.html">Grid</a>, <a href="qml-qtquick-layouts-gridlayout.html">GridLayout</a>, <a href="qml-qtquick-image.html">Image</a>, <a href="qml-qtquick-loader.html">Loader</a>, <a href="qml-qtquick-mousearea.html">MouseArea</a>, <a href="qml-qtquick-multipointtoucharea.html">MultiPointTouchArea</a>, <a href="qml-qtquick-particles-particlepainter.html">ParticlePainter</a>, <a href="qml-qtquick-pathview.html">PathView</a>, <a href="qml-qtquick-pincharea.html">PinchArea</a>, <a href="qml-qtquick-rectangle.html">Rectangle</a>, <a href="qml-qtquick-repeater.html">Repeater</a>, <a href="qml-qtquick-row.html">Row</a>, <a href="qml-qtquick-layouts-rowlayout.html">RowLayout</a>, <a href="qml-qtquick-shadereffect.html">ShaderEffect</a>, <a href="qml-qtquick-shadereffectsource.html">ShaderEffectSource</a>, <a href="qml-qtquick-shapes-shape.html">Shape</a>, <a href="qml-qttest-signalspy.html">SignalSpy</a>, <a href="qml-qtquick-spritesequence.html">SpriteSequence</a>, <a href="qml-qtquick-layouts-stacklayout.html">StackLayout</a>, <a href="qml-qttest-testcase.html">TestCase</a>, <a href="qml-qtquick-text.html">Text</a>, <a href="qml-qtquick-textedit.html">TextEdit</a>, and <a href="qml-qtquick-textinput.html">TextInput</a></p>
</td></tr></table></div><ul>
<li><a href="qml-qtquick-item-members.html">所有成员的列表，包括继承成员</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">属性</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-item.html#activeFocus-prop">activeFocus</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#activeFocusOnTab-prop">activeFocusOnTab</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#anchors-prop">anchors</a></b></b><ul>
<li class="fn"><b><b><a href="qml-qtquick-item.html#anchors.top-prop">anchors.top</a></b></b> : AnchorLine</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#anchors.bottom-prop">anchors.bottom</a></b></b> : AnchorLine</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#anchors.left-prop">anchors.left</a></b></b> : AnchorLine</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#anchors.right-prop">anchors.right</a></b></b> : AnchorLine</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#anchors.horizontalCenter-prop">anchors.horizontalCenter</a></b></b> : AnchorLine</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#anchors.verticalCenter-prop">anchors.verticalCenter</a></b></b> : AnchorLine</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#anchors.baseline-prop">anchors.baseline</a></b></b> : AnchorLine</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#anchors.fill-prop">anchors.fill</a></b></b> : Item</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#anchors.centerIn-prop">anchors.centerIn</a></b></b> : Item</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#anchors.margins-prop">anchors.margins</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#anchors.topMargin-prop">anchors.topMargin</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#anchors.bottomMargin-prop">anchors.bottomMargin</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#anchors.leftMargin-prop">anchors.leftMargin</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#anchors.rightMargin-prop">anchors.rightMargin</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#anchors.horizontalCenterOffset-prop">anchors.horizontalCenterOffset</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#anchors.verticalCenterOffset-prop">anchors.verticalCenterOffset</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#anchors.baselineOffset-prop">anchors.baselineOffset</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#anchors.alignWhenCentered-prop">anchors.alignWhenCentered</a></b></b> : bool</li>
</ul>
</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#antialiasing-prop">antialiasing</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#baselineOffset-prop">baselineOffset</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#children-prop">children</a></b></b> : list&lt;Item&gt;</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#childrenRect-prop">childrenRect</a></b></b><ul>
<li class="fn"><b><b><a href="qml-qtquick-item.html#childrenRect.x-prop">childrenRect.x</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#childrenRect.y-prop">childrenRect.y</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#childrenRect.width-prop">childrenRect.width</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#childrenRect.height-prop">childrenRect.height</a></b></b> : real</li>
</ul>
</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#clip-prop">clip</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#containmentMask-prop">containmentMask</a></b></b> : QObject*</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#data-prop">data</a></b></b> : list&lt;Object&gt;</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#enabled-prop">enabled</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#focus-prop">focus</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#height-prop">height</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#implicitHeight-prop">implicitHeight</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#implicitWidth-prop">implicitWidth</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#layer.effect-prop">layer.effect</a></b></b> : Component</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#layer.enabled-prop">layer.enabled</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#layer.format-prop">layer.format</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#layer.mipmap-prop">layer.mipmap</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#layer.samplerName-prop">layer.samplerName</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#layer.samples-prop">layer.samples</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#layer.smooth-prop">layer.smooth</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#layer.sourceRect-prop">layer.sourceRect</a></b></b> : rect</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#layer.textureMirroring-prop">layer.textureMirroring</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#layer.textureSize-prop">layer.textureSize</a></b></b> : size</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#layer.wrapMode-prop">layer.wrapMode</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#opacity-prop">opacity</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#parent-prop">parent</a></b></b> : Item</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#resources-prop">resources</a></b></b> : list&lt;Object&gt;</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#rotation-prop">rotation</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#scale-prop">scale</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#smooth-prop">smooth</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#state-prop">state</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#states-prop">states</a></b></b> : list&lt;State&gt;</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#transform-prop">transform</a></b></b> : list&lt;Transform&gt;</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#transformOrigin-prop">transformOrigin</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#transitions-prop">transitions</a></b></b> : list&lt;Transition&gt;</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#visible-prop">visible</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#visibleChildren-prop">visibleChildren</a></b></b> : list&lt;Item&gt;</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#width-prop">width</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#x-prop">x</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#y-prop">y</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#z-prop">z</a></b></b> : real</li>
</ul>
<a name="methods"></a>
<h2 id="methods">Methods</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-item.html#childAt-method">childAt</a></b></b>(real <i>x</i>,  real <i>y</i>)</li>
<li class="fn">bool <b><b><a href="qml-qtquick-item.html#contains-method">contains</a></b></b>(point <i>point</i>)</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#forceActiveFocus-method">forceActiveFocus</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#forceActiveFocus-method-1">forceActiveFocus</a></b></b>(Qt::FocusReason <i>reason</i>)</li>
<li class="fn">bool <b><b><a href="qml-qtquick-item.html#grabToImage-method">grabToImage</a></b></b>(<i>callback</i>, <i>targetSize</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-item.html#mapFromGlobal-method">mapFromGlobal</a></b></b>(real <i>x</i>,  real <i>y</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-item.html#mapFromItem-method">mapFromItem</a></b></b>(Item <i>item</i>,  real <i>x</i>,  real <i>y</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-item.html#mapFromItem-method-1">mapFromItem</a></b></b>(Item <i>item</i>,  real <i>x</i>,  real <i>y</i>,  real <i>width</i>,  real <i>height</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-item.html#mapToGlobal-method">mapToGlobal</a></b></b>(real <i>x</i>,  real <i>y</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-item.html#mapToItem-method">mapToItem</a></b></b>(Item <i>item</i>,  real <i>x</i>,  real <i>y</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-item.html#mapToItem-method-1">mapToItem</a></b></b>(Item <i>item</i>,  real <i>x</i>,  real <i>y</i>,  real <i>width</i>,  real <i>height</i>)</li>
<li class="fn"><b><b><a href="qml-qtquick-item.html#nextItemInFocusChain-method">nextItemInFocusChain</a></b></b>(bool <i>forward</i>)</li>
</ul>
<!-- $$$Item-description -->
<a name="details"></a>
<h2 id="details">详细信息</h2>
<p>Item 类型是 Qt Quick 中所有可视项的基类型。</p>
<p>Qt Quick 中的所有可视项都继承自 Item。尽管 Item 对象没有视觉外观，但它定义了所有视觉项共有的属性，例如 x 和 y 位置、宽度和高度、<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-positioning-anchors.html">锚定</a>和键处理支持。</p>
<p>项类型可用于将多个项分组到单个根可视项下。例如：</p>
<pre class="qml">

  import QtQuick 2.0

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
      <span class="type"><a href="qml-qtquick-image.html">Image</a></span> {
          <span class="name">source</span>: <span class="string">&quot;tile.png&quot;</span>
      }
      <span class="type"><a href="qml-qtquick-image.html">Image</a></span> {
          <span class="name">x</span>: <span class="number">80</span>
          <span class="name">width</span>: <span class="number">100</span>
          <span class="name">height</span>: <span class="number">100</span>
          <span class="name">source</span>: <span class="string">&quot;tile.png&quot;</span>
      }
      <span class="type"><a href="qml-qtquick-image.html">Image</a></span> {
          <span class="name">x</span>: <span class="number">190</span>
          <span class="name">width</span>: <span class="number">100</span>
          <span class="name">height</span>: <span class="number">100</span>
          <span class="name">fillMode</span>: <span class="name">Image</span>.<span class="name">Tile</span>
          <span class="name">source</span>: <span class="string">&quot;tile.png&quot;</span>
      }
  }

</pre>
<a name="key-handling"></a>
<h3 >键处理</h3>
<p>通过<a href="qml-qtquick-keys.html">Keys</a>附加属性，所有基于项的可视类型都可以使用键处理。<a href="qml-qtquick-keys.html">Keys</a>附加属性提供基本信号，如<a href="qml-qtquick-keys.html#pressed-signal">按下</a>和<a href="qml-qtquick-keys.html#released-signal">释放</a>，以及特定键的信号，如<a href="qml-qtquick-keys.html#spacePressed-signal">spacePressed</a>。下面的例子将<a href="qtquick-input-focus.html">键盘焦点</a>分配给项，并通过通用的onPressed处理程序处理左键，通过<code>onReturnPressed</code> 
处理程序处理返回键:</p>
<pre class="qml">

  import QtQuick 2.0

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
      <span class="name">focus</span>: <span class="number">true</span>
      <span class="name">Keys</span>.onPressed: {
          <span class="keyword">if</span> (<span class="name">event</span>.<span class="name">key</span> <span class="operator">==</span> <span class="name">Qt</span>.<span class="name">Key_Left</span>) {
              <span class="name">console</span>.<span class="name">log</span>(<span class="string">&quot;move left&quot;</span>);
              <span class="name">event</span>.<span class="name">accepted</span> <span class="operator">=</span> <span class="number">true</span>;
          }
      }
      <span class="name">Keys</span>.onReturnPressed: <span class="name">console</span>.<span class="name">log</span>(<span class="string">&quot;Pressed return&quot;</span>);
  }

</pre>
<p>有关详细文档，请参阅<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-keys.html">Keys</a>附加属性。</p>
<a name="layout-mirroring"></a>
<h3 >布局镜像</h3>
<p>可以使用<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-layoutmirroring.html">LayoutMirroring</a>附加属性镜像项布局。这会导致<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#anchors.top-prop">锚点</a>水平反转，并且还会导致布局或定位其子项（例如<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-listview.html">ListView</a>或<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-row.html">Row</a>）的项水平反转其布局方向。</p>
<p>有关更多详细信息，请参阅<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-layoutmirroring.html">LayoutMirroring</a>。</p>
<a name="item-layers"></a>
<h2 id="item-layers">项层</h2>
<p>一个 Item 通常会直接渲染到它所属的窗口中。但是，通过设置<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#layer.enabled-prop">layer.enabled</a>，可以将项及其整个子树委托到屏幕外表面。只有屏幕外的表面，一个纹理，将被绘制到窗口中。</p>
<p>如果希望具有与项不同的纹理大小，可以使用<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#layer.textureSize-prop">layer.textureSize</a>。要仅将项的一部分渲染到纹理中，请使用<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#layer.sourceRect-prop">layer.sourceRect</a>。也可以指定<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#layer.sourceRect-prop">layer.sourceRect</a>使其超出项的范围。在这种情况下，外部将填充透明像素。</p>
<p>如果<a href="qml-qtquick-item.html#layer.smooth-prop">layer.smooth</a>设置为<code>true</code>，该项将使用线性插值进行缩放，如果<a href="qml-qtquick-item.html#layer.mipmap-prop">layer.mipmap</a>设置为<code>true</code> 
，该项将使用mipmap进行下采样。Mipmapping可以改善缩小的项的视觉质量。对于单个Image项的mipmapping，首选Image::mipmap。</p>
<a name="layer-opacity-vs-item-opacity"></a>
<h3 >图层不透明度与项不透明度</h3>
<p>将<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-effects-topic.html#opacity">不透明度</a>应用于项层次结构时，不透明度将单独应用于每个项。当不透明度应用于子树时，这可能会导致不希望的视觉结果。考虑以下示例：</p>
<div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><img src="images/qml-blending-nonlayered.png" alt="" /></td><td ><b>非分层不透明度</b><pre class="qml">

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
      <span class="name">id</span>: <span class="name">nonLayered</span>

      <span class="name">opacity</span>: <span class="number">0.5</span>

      <span class="name">width</span>: <span class="number">100</span>
      <span class="name">height</span>: <span class="number">100</span>

      <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> { <span class="name">width</span>: <span class="number">80</span>; <span class="name">height</span>: <span class="number">80</span>; <span class="name">border</span>.width: <span class="number">1</span> }
      <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> { <span class="name">x</span>: <span class="number">20</span>; <span class="name">y</span>: <span class="number">20</span>; <span class="name">width</span>: <span class="number">80</span>; <span class="name">height</span>: <span class="number">80</span>; <span class="name">border</span>.width: <span class="number">1</span> }
  }

</pre>
</td></tr>
</table></div>
<p>渲染一个图层，根项的不透明度为 1，然后在绘制纹理时将根项的不透明度应用于纹理。这意味着在大型项层次结构中从透明淡入到不透明或反之亦然，可以在没有正常逐项 alpha 混合所具有的重叠伪影的情况下完成。这是启用图层的相同示例：</p>
<div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><p class="centerAlign"><img src="images/qml-blending-layered.png" alt="" /></p></td><td ><b>分层不透明度</b><pre class="qml">

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
      <span class="name">id</span>: <span class="name">layered</span>

      <span class="name">opacity</span>: <span class="number">0.5</span>

      <span class="name">layer</span>.enabled: <span class="number">true</span>

      <span class="name">width</span>: <span class="number">100</span>
      <span class="name">height</span>: <span class="number">100</span>

      <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> { <span class="name">width</span>: <span class="number">80</span>; <span class="name">height</span>: <span class="number">80</span>; <span class="name">border</span>.width: <span class="number">1</span> }
      <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> { <span class="name">x</span>: <span class="number">20</span>; <span class="name">y</span>: <span class="number">20</span>; <span class="name">width</span>: <span class="number">80</span>; <span class="name">height</span>: <span class="number">80</span>; <span class="name">border</span>.width: <span class="number">1</span> }
  }

</pre>
</td></tr>
</table></div>
<a name="combined-with-shadereffects"></a>
<h3 >结合 ShaderEffects</h3>
<p>将<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#layer.enabled-prop">layer.enabled</a>设置为 true 会将项转换为<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qquickitem.html#isTextureProvider">纹理提供程序</a>，从而可以将项直接用作纹理，例如与<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-shadereffect.html">ShaderEffect</a>类型结合使用。</p>
<p>可以在运行时使用 layer.effect 对图层应用效果：</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
      <span class="name">id</span>: <span class="name">layerRoot</span>
      <span class="name">layer</span>.enabled: <span class="number">true</span>
      <span class="name">layer</span>.effect: <span class="name">ShaderEffect</span> {
          <span class="name">fragmentShader</span>: <span class="string">&quot;
              uniform lowp sampler2D source; // this item
              uniform lowp float qt_Opacity; // inherited opacity of this item
              varying highp vec2 qt_TexCoord0;
              void main() {
                  lowp vec4 p = texture2D(source, qt_TexCoord0);
                  lowp float g = dot(p.xyz, vec3(0.344, 0.5, 0.156));
                  gl_FragColor = vec4(g, g, g, p.a) * qt_Opacity;
              }&quot;</span>
      }

</pre>
<p>在本例中，我们手动实现着色器效果。<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtgraphicaleffects/qtgraphicaleffects-index.html">Qt Graphical Effects</a>模块包含一套与 Qt Quick 一起使用的现成效果。</p>
<p>有关使用效果的更多信息，请参阅<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-shadereffect.html">ShaderEffect</a>。</p>
<p><b>注意：</b><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#layer.enabled-prop">layer.enabled</a>实际上只是使用<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-shadereffectsource.html">ShaderEffectSource</a>的一种更方便的方式。</p><a name="memory-and-performance"></a>
<h3 >内存和性能</h3>
<p>启用项的图层时，场景图将在 GPU 中分配等于<code>width x height x 4</code>. 在内存受限的配置中，应谨慎使用大层。</p>
<p>在<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtgui/qpainter.html">QPainter</a> / <a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtwidgets/qwidget.html">QWidget</a>世界中，有时将复杂内容缓存在像素图、图像或纹理中是有利的。在 Qt Quick 中，由于<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-visualcanvas-scenegraph-renderer.html">场景图渲染器</a>已经应用了技术，大多数情况下并非如此。由于批处理已经减少了过多的绘制调用，并且缓存在大多数情况下最终会混合比原始内容更多的像素。因此，渲染到屏幕外的开销以及绘制结果纹理所涉及的混合通常比简单地让项及其子项正常绘制更昂贵。</p>
<p>此外，使用图层的项在渲染期间无法<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-visualcanvas-scenegraph-renderer.html#batching">批处理。</a>这意味着具有许多分层项的场景可能存在性能问题。</p>
<p>分层对于视觉效果可能很方便和有用，但在大多数情况下应该在效果期间启用并在之后禁用。</p>
<!-- @@@Item -->
<h2>属性文档</h2>
<!-- $$$activeFocus -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="activeFocus-prop">
<td class="tblQmlPropNode"><p>
<a name="activeFocus-prop"></a><span class="name">activeFocus</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此只读属性指示项是否具有活动焦点。</p>
<p>如果 activeFocus 为 true，则此项是当前接收键盘输入的项，或者是当前接收键盘输入的项的<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-focusscope.html">FocusScope</a>祖先。</p>
<p>通常，通过将<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#focus-prop">焦点</a>设置在项及其封闭的<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-focusscope.html">FocusScope</a>对象上来获得 activeFocus。在以下示例中，<code>input</code>and<code>focusScope</code>对象将具有活动焦点，而根矩形对象则不会。</p>
<pre class="qml">

  import QtQuick 2.0

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>

      <span class="type"><a href="qml-qtquick-focusscope.html">FocusScope</a></span> {
          <span class="name">id</span>: <span class="name">focusScope</span>
          <span class="name">focus</span>: <span class="number">true</span>

          <span class="type"><a href="qml-qtquick-textinput.html">TextInput</a></span> {
              <span class="name">id</span>: <span class="name">input</span>
              <span class="name">focus</span>: <span class="number">true</span>
          }
      }
  }

</pre>
<p><b>请参考 </b><a href="qml-qtquick-item.html#focus-prop">焦点</a> 和  
<a href="qtquick-input-focus.html">Qt Quick中的键盘焦点</a>。</p>
</div></div><!-- @@@activeFocus -->
<br/>
<!-- $$$activeFocusOnTab -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="activeFocusOnTab-prop">
<td class="tblQmlPropNode"><p>
<a name="activeFocusOnTab-prop"></a><span class="name">activeFocusOnTab</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此属性保存项是否要位于选项卡焦点链中。默认情况下，此设置为<code>false</code>。</p>
<p>选项卡焦点链首先访问父元素，然后按照它们在 children 属性中出现的顺序遍历其子元素。在选项卡焦点链中的项上按 Tab 键会将键盘焦点移动到链中的下一个项。按 BackTab（通常是 Shift+Tab）会将焦点移至上一项。</p>
<p>要设置手动选项卡焦点链，请参见<a href="qml-qtquick-keynavigation.html">KeyNavigation</a>。键或<a href="qml-qtquick-keynavigation.html">KeyNavigation</a>使用的Tab键事件优先于焦点链行为;忽略其他键处理程序中的事件，以允许它传播。</p>
</div></div><!-- @@@activeFocusOnTab -->
<br/>
<!-- $$$anchors -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="even" id="anchors-prop"><th class="centerAlign"><p><a name="anchors-prop"></a><b>anchors group</b></p></th></tr><tr valign="top" class="odd" id="anchors.top-prop"><td class="tblQmlPropNode"><p><a name="anchors.top-prop"></a><span class="name">anchors.top</span> : <span class="type">AnchorLine</span></p></td></tr><tr valign="top" class="odd" id="anchors.bottom-prop"><td class="tblQmlPropNode"><p><a name="anchors.bottom-prop"></a><span class="name">anchors.bottom</span> : <span class="type">AnchorLine</span></p></td></tr><tr valign="top" class="odd" id="anchors.left-prop"><td class="tblQmlPropNode"><p><a name="anchors.left-prop"></a><span class="name">anchors.left</span> : <span class="type">AnchorLine</span></p></td></tr><tr valign="top" class="odd" id="anchors.right-prop"><td class="tblQmlPropNode"><p><a name="anchors.right-prop"></a><span class="name">anchors.right</span> : <span class="type">AnchorLine</span></p></td></tr><tr valign="top" class="odd" id="anchors.horizontalCenter-prop"><td class="tblQmlPropNode"><p><a name="anchors.horizontalCenter-prop"></a><span class="name">anchors.horizontalCenter</span> : <span class="type">AnchorLine</span></p></td></tr><tr valign="top" class="odd" id="anchors.verticalCenter-prop"><td class="tblQmlPropNode"><p><a name="anchors.verticalCenter-prop"></a><span class="name">anchors.verticalCenter</span> : <span class="type">AnchorLine</span></p></td></tr><tr valign="top" class="odd" id="anchors.baseline-prop"><td class="tblQmlPropNode"><p><a name="anchors.baseline-prop"></a><span class="name">anchors.baseline</span> : <span class="type">AnchorLine</span></p></td></tr><tr valign="top" class="odd" id="anchors.fill-prop"><td class="tblQmlPropNode"><p><a name="anchors.fill-prop"></a><span class="name">anchors.fill</span> : <span class="type"><a href="qml-qtquick-item.html">Item</a></span></p></td></tr><tr valign="top" class="odd" id="anchors.centerIn-prop"><td class="tblQmlPropNode"><p><a name="anchors.centerIn-prop"></a><span class="name">anchors.centerIn</span> : <span class="type"><a href="qml-qtquick-item.html">Item</a></span></p></td></tr><tr valign="top" class="odd" id="anchors.margins-prop"><td class="tblQmlPropNode"><p><a name="anchors.margins-prop"></a><span class="name">anchors.margins</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr><tr valign="top" class="odd" id="anchors.topMargin-prop"><td class="tblQmlPropNode"><p><a name="anchors.topMargin-prop"></a><span class="name">anchors.topMargin</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr><tr valign="top" class="odd" id="anchors.bottomMargin-prop"><td class="tblQmlPropNode"><p><a name="anchors.bottomMargin-prop"></a><span class="name">anchors.bottomMargin</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr><tr valign="top" class="odd" id="anchors.leftMargin-prop"><td class="tblQmlPropNode"><p><a name="anchors.leftMargin-prop"></a><span class="name">anchors.leftMargin</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr><tr valign="top" class="odd" id="anchors.rightMargin-prop"><td class="tblQmlPropNode"><p><a name="anchors.rightMargin-prop"></a><span class="name">anchors.rightMargin</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr><tr valign="top" class="odd" id="anchors.horizontalCenterOffset-prop"><td class="tblQmlPropNode"><p><a name="anchors.horizontalCenterOffset-prop"></a><span class="name">anchors.horizontalCenterOffset</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr><tr valign="top" class="odd" id="anchors.verticalCenterOffset-prop"><td class="tblQmlPropNode"><p><a name="anchors.verticalCenterOffset-prop"></a><span class="name">anchors.verticalCenterOffset</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr><tr valign="top" class="odd" id="anchors.baselineOffset-prop"><td class="tblQmlPropNode"><p><a name="anchors.baselineOffset-prop"></a><span class="name">anchors.baselineOffset</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr><tr valign="top" class="odd" id="anchors.alignWhenCentered-prop"><td class="tblQmlPropNode"><p><a name="anchors.alignWhenCentered-prop"></a><span class="name">anchors.alignWhenCentered</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr></table></div></div><div class="qmldoc"><p>锚点提供了一种通过指定项与其他项的关系来定位项的方法。</p>
<p>边距适用于顶部、底部、左侧、右侧和填充锚点。anchors.margins属性可用于一次将所有不同的边距设置为相同的值<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#anchors.margins-prop">。</a>它不会覆盖先前设置的特定边距；要清除显式边距，请将其值设置为<code>undefined</code>。请注意，边距是特定于锚点的，如果项不使用锚点，则不会应用边距。</p>
<p>偏移量适用于水平中心、垂直中心和基线锚点。</p>
<div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><p class="centerAlign"><img src="images/declarative-anchors_example.png" alt="" /></p></td><td >锚定到图像的文本，水平居中，垂直下方，带有边距。<pre class="qml">

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
      <span class="type"><a href="qml-qtquick-image.html">Image</a></span> {
          <span class="name">id</span>: <span class="name">pic</span>
          <span class="comment">// ...</span>
      }
      <span class="type"><a href="qml-qtquick-text.html">Text</a></span> {
          <span class="name">id</span>: <span class="name">label</span>
          <span class="name">anchors</span>.horizontalCenter: <span class="name">pic</span>.<span class="name">horizontalCenter</span>
          <span class="name">anchors</span>.top: <span class="name">pic</span>.<span class="name">bottom</span>
          <span class="name">anchors</span>.topMargin: <span class="number">5</span>
          <span class="comment">// ...</span>
      }
  }

</pre>
</td></tr>
<tr valign="top" class="even"><td ><p class="centerAlign"><img src="images/declarative-anchors_example2.png" alt="" /></p></td><td >文本的左侧锚定在图像的右侧，带有边距。两者的 y 属性默认为 0。<pre class="qml">

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
      <span class="type"><a href="qml-qtquick-image.html">Image</a></span> {
          <span class="name">id</span>: <span class="name">pic</span>
          <span class="comment">// ...</span>
      }
      <span class="type"><a href="qml-qtquick-text.html">Text</a></span> {
          <span class="name">id</span>: <span class="name">label</span>
          <span class="name">anchors</span>.left: <span class="name">pic</span>.<span class="name">right</span>
          <span class="name">anchors</span>.leftMargin: <span class="number">5</span>
          <span class="comment">// ...</span>
      }
  }

</pre>
</td></tr>
</table></div>
<p><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#anchors.fill-prop">anchors.fill</a>为一个 item 与另一个 item 具有相同的几何图形提供了一种便捷的方式，相当于连接了所有四个定向锚点。</p>
<p>要清除锚值，请将其设置为<code>undefined</code>。</p>
<p><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#anchors.alignWhenCentered-prop">anchors.alignWhenCentered</a>（默认<code>true</code>）强制居中的锚点对齐到整个像素；如果居中的项具有奇数的<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#width-prop">宽度</a>或<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#height-prop">高度</a>，则项将定位在整个像素上，而不是放置在半像素上。这确保了项被清晰地绘制。在某些情况下，这是不可取的，例如当旋转项时，由于中心是圆形的，抖动可能很明显。</p>
<p><b>注意：</b>您只能将项锚定到同级或父级。</p><p>有关更多信息，请参阅<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-positioning-anchors.html">锚布局</a>。</p>
</div></div><!-- @@@anchors -->
<br/>
<!-- $$$antialiasing -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="antialiasing-prop">
<td class="tblQmlPropNode"><p>
<a name="antialiasing-prop"></a><span class="name">antialiasing</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>由视觉元素用来决定项是否应该使用抗锯齿。在某些情况下，具有抗锯齿功能的项需要更多内存并且渲染速度可能较慢（有关详细信息，请参阅<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-visualcanvas-scenegraph-renderer.html#antialiasing">抗锯齿）。</a></p>
<p>默认值为 false，但可能会被派生元素覆盖。</p>
</div></div><!-- @@@antialiasing -->
<br/>
<!-- $$$baselineOffset -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="baselineOffset-prop">
<td class="tblQmlPropNode"><p>
<a name="baselineOffset-prop"></a><span class="name">baselineOffset</span> : <span class="type"><a href="../qtqml/qml-int.html">int</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>指定项基线在本地坐标中的位置。</p>
<p><a href="qml-qtquick-text.html">Text</a>项的基线是文本所在的假想线。包含文本的控件通常将其基线设置为其文本的基线。</p>
<p>对于非文本项，使用默认的基线偏移量 0。</p>
</div></div><!-- @@@baselineOffset -->
<br/>
<!-- $$$children -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="children-prop">
<td class="tblQmlPropNode"><p>
<a name="children-prop"></a><span class="name">children</span> : <span class="type"><a href="../qtqml/qml-list.html">list</a></span>&lt;<span class="type"><a href="qml-qtquick-item.html">Item</a></span>&gt;</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>children 属性包含此项的可视子项列表。resources 属性包含要按名称引用的非可视资源。</p>
<p>添加子项或资源时，通常不需要引用这些属性，因为默认<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#data-prop">数据</a>属性会根据需要自动将子对象分配给<code>children</code>和<code>resources</code>属性。有关详细信息，请参阅<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#data-prop">数据</a>文档。</p>
</div></div><!-- @@@children -->
<br/>
<!-- $$$childrenRect -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="even" id="childrenRect-prop"><th class="centerAlign"><p><a name="childrenRect-prop"></a><b>childrenRect group</b></p></th></tr><tr valign="top" class="odd" id="childrenRect.x-prop"><td class="tblQmlPropNode"><p><a name="childrenRect.x-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">childrenRect.x</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr><tr valign="top" class="odd" id="childrenRect.y-prop"><td class="tblQmlPropNode"><p><a name="childrenRect.y-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">childrenRect.y</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr><tr valign="top" class="odd" id="childrenRect.width-prop"><td class="tblQmlPropNode"><p><a name="childrenRect.width-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">childrenRect.width</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr><tr valign="top" class="odd" id="childrenRect.height-prop"><td class="tblQmlPropNode"><p><a name="childrenRect.height-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">childrenRect.height</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr></table></div></div><div class="qmldoc"><p>此只读属性保存项子项的集体位置和大小。</p>
<p>如果您需要访问项的子项的集体几何图形以正确调整项的大小，则此属性很有用。</p>
</div></div><!-- @@@childrenRect -->
<br/>
<!-- $$$clip -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="clip-prop">
<td class="tblQmlPropNode"><p>
<a name="clip-prop"></a><span class="name">clip</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此属性保存是否启用剪辑。默认剪辑值为<code>false</code>。</p>
<p>如果启用了剪辑，则项会将其自己的绘画以及其子项的绘画剪辑到其边界矩形。</p>
</div></div><!-- @@@clip -->
<br/>
<!-- $$$containmentMask -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="containmentMask-prop">
<td class="tblQmlPropNode"><p>
<a name="containmentMask-prop"></a><span class="name">containmentMask</span> : <span class="type">QObject</span>*</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此属性包含要在<a href="qml-qtquick-item.html#contains-method">QtQuick::Item::contains</a>方法中使用的 
		Item 的可选掩码。<a href="qml-qtquick-item.html#contains-method">QtQuick::Item::contains</a>目前主要用途是判断输入事件是否已经到达项。</p>
<p>默认情况下，<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#contains-method">contains</a>方法将为 Item 边界框中的任何点返回 true。<code>containmentMask</code>允许更细粒度的控制。例如，开发人员可以定义并使用 AnotherItem 元素作为 containsMask，它具有专门的 contains 方法，例如：</p>
<pre class="cpp">

  Item { id: item; containmentMask: AnotherItem { id: anotherItem } }

</pre>
<p>只有当<i>anotherItem</i>的 contains 实现返回 true时， <i>item</i>的 contains 方法才会返回 
true。</p>
<p>这个属性是在 Qt 5.11 中引入的。</p>
</div></div><!-- @@@containmentMask -->
<br/>
<!-- $$$data -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="data-prop">
<td class="tblQmlPropNode"><p>
<a name="data-prop"></a><span class="qmldefault">[default] </span><span class="name">data</span> : <span class="type"><a href="../qtqml/qml-list.html">list</a></span>&lt;<span class="type">Object</span>&gt;</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>data 属性允许您在项中自由混合可视子项和资源。如果您将可视项分配给数据列表，它将成为子项，如果您分配任何其他对象类型，则将其添加为资源。</p>
<p>所以你可以这样写：</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
      <span class="type"><a href="qml-qtquick-text.html">Text</a></span> {}
      <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {}
      <span class="type"><a href="../qtqml/qml-qtqml-timer.html">Timer</a></span> {}
  }

</pre>
<p>代替：</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
      <span class="name">children</span>: [
          <span class="type"><a href="qml-qtquick-text.html">Text</a></span> {},
          <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {}
      ]
      <span class="name">resources</span>: [
          <span class="type"><a href="../qtqml/qml-qtqml-timer.html">Timer</a></span> {}
      ]
  }

</pre>
<p>通常不需要引用该<code>data</code>属性，因为它是 Item 的默认属性，因此所有子项都会自动分配给该属性。</p>
</div></div><!-- @@@data -->
<br/>
<!-- $$$enabled -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="enabled-prop">
<td class="tblQmlPropNode"><p>
<a name="enabled-prop"></a><span class="name">enabled</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此属性保存项是否接收鼠标和键盘事件。默认情况下这是真的。</p>
<p>设置此属性将直接影响子项的<code>enabled</code> 值。当设置为<code>false</code>时，所有子项的<code>enabled</code> 
值也变为<code>false</code>。当设置为<code>true</code>时，子项的<code>enabled</code> 值将返回<code>true</code>，除非它们被显式地设置为<code>false</code>。</p>
<p>将此属性设置为<code>false</code>自动会导致<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#activeFocus-prop">activeFocus</a>设置为<code>false</code>，并且该项将不再接收键盘事件。</p>
<p><b>请参考 </b><a href="qml-qtquick-item.html#visible-prop">visible</a>。</p>
</div></div><!-- @@@enabled -->
<br/>
<!-- $$$focus -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="focus-prop">
<td class="tblQmlPropNode"><p>
<sub>
<a name="focus-prop"></a></sub><span class="name">focus</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div>
	<div class="qmldoc"><p>这个属性保存了项在封闭的<a href="qml-qtquick-focusscope.html">FocusScope</a>中是否有焦点。如果为真，当封闭的FocusScope获得活动焦点时，这个项将获得活动焦点。</p>
		<p>在以下示例中，当获得主动<code>input</code>焦点时将<code>scope</code>获得主动焦点：</p>
		<pre class="qml">
  import QtQuick 2.0

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>

      <span class="type"><a href="qml-qtquick-focusscope.html">FocusScope</a></span> {
          <span class="name">id</span>: <span class="name">scope</span>

          <span class="type"><a href="qml-qtquick-textinput.html">TextInput</a></span> {
              <span class="name">id</span>: <span class="name">input</span>
              <span class="name">focus</span>: <span class="number">true</span>
          }
      }
  }

</pre>
		<p>出于此属性的目的，假设整个场景就像一个焦点范围。在实践层面上，这意味着以下 QML 将积极关注<code>input</code>启动。</p>
		<pre class="qml">
  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>

      <span class="type"><a href="qml-qtquick-textinput.html">TextInput</a></span> {
            <span class="name">id</span>: <span class="name">input</span>
            <span class="name">focus</span>: <span class="number">true</span>
      }
  }

</pre>
		<p><b>请参考 </b><a href="qml-qtquick-item.html#activeFocus-prop">activeFocus</a> 和  
		<a href="qtquick-input-focus.html">Qt Quick中的键盘焦点</a>。</p>
</div>
	</div><!-- @@@focus -->
<br/>
<!-- $$$height -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="height-prop">
<td class="tblQmlPropNode"><p>
<a name="height-prop"></a><span class="name">height</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>定义项的位置和大小。默认值为<code>0</code>。</p>
<p>(x,y) 位置是相对于<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#parent-prop">parent</a>的。</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> { <span class="name">x</span>: <span class="number">100</span>; <span class="name">y</span>: <span class="number">100</span>; <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span> }

</pre>
</div></div><!-- @@@height -->
<br/>
<!-- $$$implicitHeight -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="implicitHeight-prop">
<td class="tblQmlPropNode"><p>
<a name="implicitHeight-prop"></a><span class="name">implicitHeight</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>如果未指定<a href="qml-qtquick-item.html#width-prop">宽度</a>或<a href="qml-qtquick-item.html#height-prop">高度</a>，则定义项的自然宽度或高度。</p>
<p>大多数项的默认隐式大小是 0x0，但是有些项具有无法覆盖的固有隐式大小，例如<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-image.html">Image</a>和<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-text.html">Text</a>。</p>
<p>设置隐式大小对于根据内容定义具有首选大小的组件很有用，例如：</p>
<pre class="qml">

  <span class="comment">// Label.qml</span>
  import QtQuick 2.0

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
      property <span class="type">alias</span> <span class="name">icon</span>: <span class="name">image</span>.<span class="name">source</span>
      property <span class="type">alias</span> <span class="name">label</span>: <span class="name">text</span>.<span class="name">text</span>
      <span class="name">implicitWidth</span>: <span class="name">text</span>.<span class="name">implicitWidth</span> <span class="operator">+</span> <span class="name">image</span>.<span class="name">implicitWidth</span>
      <span class="name">implicitHeight</span>: <span class="name">Math</span>.<span class="name">max</span>(<span class="name">text</span>.<span class="name">implicitHeight</span>, <span class="name">image</span>.<span class="name">implicitHeight</span>)
      <span class="type"><a href="qml-qtquick-image.html">Image</a></span> { <span class="name">id</span>: <span class="name">image</span> }
      <span class="type"><a href="qml-qtquick-text.html">Text</a></span> {
          <span class="name">id</span>: <span class="name">text</span>
          <span class="name">wrapMode</span>: <span class="name">Text</span>.<span class="name">Wrap</span>
          <span class="name">anchors</span>.left: <span class="name">image</span>.<span class="name">right</span>; <span class="name">anchors</span>.right: <span class="name">parent</span>.<span class="name">right</span>
          <span class="name">anchors</span>.verticalCenter: <span class="name">parent</span>.<span class="name">verticalCenter</span>
      }
  }

</pre>
<p><b>注意：</b>使用<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-text.html">Text</a>或<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-textedit.html">TextEdit</a>的<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#implicitWidth-prop">implicitWidth</a>并显式设置宽度会导致性能损失，因为文本必须布局两次。<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-text.html"></a><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-textedit.html"></a></p></div></div><!-- @@@implicitHeight -->
<br/>
<!-- $$$implicitWidth -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="implicitWidth-prop">
<td class="tblQmlPropNode"><p>
<a name="implicitWidth-prop"></a><span class="name">implicitWidth</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>如果未指定<a href="qml-qtquick-item.html#width-prop">宽度</a>或<a href="qml-qtquick-item.html#height-prop">高度</a>，则定义项的自然宽度或高度。</p>
<p>大多数项的默认隐式大小是 0x0，但是有些项具有无法覆盖的固有隐式大小，例如<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-image.html">Image</a>和<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-text.html">Text</a>。</p>
<p>设置隐式大小对于根据内容定义具有首选大小的组件很有用，例如：</p>
<pre class="qml">

  <span class="comment">// Label.qml</span>
  import QtQuick 2.0

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
      property <span class="type">alias</span> <span class="name">icon</span>: <span class="name">image</span>.<span class="name">source</span>
      property <span class="type">alias</span> <span class="name">label</span>: <span class="name">text</span>.<span class="name">text</span>
      <span class="name">implicitWidth</span>: <span class="name">text</span>.<span class="name">implicitWidth</span> <span class="operator">+</span> <span class="name">image</span>.<span class="name">implicitWidth</span>
      <span class="name">implicitHeight</span>: <span class="name">Math</span>.<span class="name">max</span>(<span class="name">text</span>.<span class="name">implicitHeight</span>, <span class="name">image</span>.<span class="name">implicitHeight</span>)
      <span class="type"><a href="qml-qtquick-image.html">Image</a></span> { <span class="name">id</span>: <span class="name">image</span> }
      <span class="type"><a href="qml-qtquick-text.html">Text</a></span> {
          <span class="name">id</span>: <span class="name">text</span>
          <span class="name">wrapMode</span>: <span class="name">Text</span>.<span class="name">Wrap</span>
          <span class="name">anchors</span>.left: <span class="name">image</span>.<span class="name">right</span>; <span class="name">anchors</span>.right: <span class="name">parent</span>.<span class="name">right</span>
          <span class="name">anchors</span>.verticalCenter: <span class="name">parent</span>.<span class="name">verticalCenter</span>
      }
  }

</pre>
<p><b>注意：</b>使用<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-text.html">Text</a>或<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-textedit.html">TextEdit</a>的implicitWidth 并显式设置宽度会导致性能损失，因为文本必须布局两次。</p></div></div><!-- @@@implicitWidth -->
<br/>
<!-- $$$layer.effect -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="layer.effect-prop">
<td class="tblQmlPropNode"><p>
<a name="layer.effect-prop"></a><span class="name">layer.effect</span> : <span class="type"><a href="../qtqml/qml-qtqml-component.html">Component</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>保存应用于此图层的效果。</p>
<p>该效果通常是一个<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-shadereffect.html">ShaderEffect</a>组件，尽管可以分配任何<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html">Item组件。</a>效果应该有一个名称匹配<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#layer.samplerName-prop">layer.samplerName</a>的源纹理属性。</p>
<p><b>请参考 </b><a href="qml-qtquick-item.html#layer.samplerName-prop">layer.samplerName</a> 和  
<a href="qml-qtquick-item.html#item-layers">项层</a>。</p>
</div></div><!-- @@@layer.effect -->
<br/>
<!-- $$$layer.enabled -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="layer.enabled-prop">
<td class="tblQmlPropNode"><p>
<a name="layer.enabled-prop"></a><span class="name">layer.enabled</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>保存项是否分层。默认情况下禁用分层。</p>
<p>分层项被渲染到屏幕外表面并被缓存，直到它被更改。为复杂的 QML 项层次结构启用分层有时可能是一种优化。</p>
<p>当图层被禁用时，其他图层属性都没有任何影响。</p>
<p><b>请参考 </b><a href="qml-qtquick-item.html#item-layers">项层</a>。</p>
</div></div><!-- @@@layer.enabled -->
<br/>
<!-- $$$layer.format -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="layer.format-prop">
<td class="tblQmlPropNode"><p>
<a name="layer.format-prop"></a><span class="name">layer.format</span> : <span class="type"><a href="../qtqml/qml-enumeration.html">enumeration</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此属性定义纹理的内部 OpenGL 格式。<i>当layer.effect</i>也被指定时，修改这个属性最有意义。根据 OpenGL 实现，此属性可能允许您节省一些纹理内存。</p>
<ul>
<li><a href="qml-qtquick-shadereffectsource.html">ShaderEffectSource</a>.Alpha - GL_ALPHA;</li>
<li><a href="qml-qtquick-shadereffectsource.html">ShaderEffectSource</a>.RGB - GL_RGB</li>
<li><a href="qml-qtquick-shadereffectsource.html">ShaderEffectSource</a>.RGBA - GL_RGBA</li>
</ul>
<p><b>注意:</b>应谨慎使用<a href="qml-qtquick-shadereffectsource.html">ShaderEffectSource</a>.RGB 
和<a href="qml-qtquick-shadereffectsource.html">ShaderEffectSource</a>.Alpha，因为底层硬件和驱动程序通常不支持这些格式。</p><p><b>请参考 </b>
		<a href="qml-qtquick-item.html#item-layers">项层。</a></p>
</div></div><!-- @@@layer.format -->
<br/>
<!-- $$$layer.mipmap -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="layer.mipmap-prop">
<td class="tblQmlPropNode"><p>
<a name="layer.mipmap-prop"></a><span class="name">layer.mipmap</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>果此属性为 true，则会为纹理生成 mipmap。</p>
<p><b>注意：</b>一些 OpenGL ES 2 实现不支持非二次幂纹理的 mipmap。</p><p><b>请参考 </b><a href="qml-qtquick-item.html#item-layers">项层</a>.</p>
</div></div><!-- @@@layer.mipmap -->
<br/>
<!-- $$$layer.samplerName -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="layer.samplerName-prop">
<td class="tblQmlPropNode"><p>
<a name="layer.samplerName-prop"></a><span class="name">layer.samplerName</span> : <span class="type"><a href="../qtqml/qml-string.html">string</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>保存效果的源纹理属性的名称。</p>
<p>此值必须与效果的源纹理属性的名称匹配，以便项可以正确地将图层的屏幕外表面传递给效果。</p>
<p><b>请参考</b> <a href="qml-qtquick-item.html#layer.effect-prop">layer.effect</a>，<a href="qml-qtquick-shadereffect.html">ShaderEffect</a> 和 <a href="qml-qtquick-item.html#item-layers">项层</a>。</p>
</div></div><!-- @@@layer.samplerName -->
<br/>
<!-- $$$layer.samples -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="layer.samples-prop">
<td class="tblQmlPropNode"><p>
<a name="layer.samples-prop"></a><span class="name">layer.samples</span> : <span class="type"><a href="../qtqml/qml-enumeration.html">enumeration</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此属性允许在图层中请求多重采样渲染。</p>
<p>默认情况下，只要为整个窗口启用多重采样，就会启用多重采样，假设正在使用的场景图渲染器和底层图形 API 支持这一点。</p>
<p>通过将值设置为 2、4 等，可以为场景的一部分请求多重采样渲染，而无需为整个场景启用多重采样。通过这种方式，多重采样仅应用于给定的子树，这可能会带来显着的性能提升，因为多重采样不会应用于场景的其他部分。</p>
<p><b>注意：</b>无论层的大小如何，启用多重采样的成本都可能很高，因为它会产生依赖于硬件和驱动程序的性能和内存成本。</p><p><b>注意：</b>此属性仅在支持多重采样渲染缓冲区和帧缓冲区位可用时才起作用。否则，该值将被静默忽略。</p><p>这个属性是在 Qt 5.10 中引入的。</p>
</div></div><!-- @@@layer.samples -->
<br/>
<!-- $$$layer.smooth -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="layer.smooth-prop">
<td class="tblQmlPropNode"><p>
<a name="layer.smooth-prop"></a><span class="name">layer.smooth</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>保存图层是否平滑变换。</p>
<p><b>请参考 </b><a href="qml-qtquick-item.html#item-layers">项层</a>。</p>
</div></div><!-- @@@layer.smooth -->
<br/>
<!-- $$$layer.sourceRect -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="layer.sourceRect-prop">
<td class="tblQmlPropNode"><p>
<a name="layer.sourceRect-prop"></a><span class="name">layer.sourceRect</span> : <span class="type"><a href="../qtqml/qml-rect.html">rect</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此属性定义应渲染到纹理中的项的矩形区域。源矩形可以大于项本身。如果矩形为空（默认值），则将整个项渲染到纹理。</p>
<p><b>请参考 </b><a href="qml-qtquick-item.html#item-layers">项层</a>。</p>
</div></div><!-- @@@layer.sourceRect -->
<br/>
<!-- $$$layer.textureMirroring -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="layer.textureMirroring-prop">
<td class="tblQmlPropNode"><p>
<a name="layer.textureMirroring-prop"></a><span class="name">layer.textureMirroring</span> : <span class="type"><a href="../qtqml/qml-enumeration.html">enumeration</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此属性定义生成的 OpenGL 纹理应如何镜像。默认值为<code>ShaderEffectSource.MirrorVertically</code>。如果生成的纹理由自定义着色器（例如由<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-shadereffect.html">ShaderEffect</a>指定的着色器）直接访问，自定义镜像会很有用。如果没有为分层项指定效果，则镜像对项的 UI 表示没有影响。</p>
<ul>
<li><a href="qml-qtquick-shadereffectsource.html">ShaderEffectSource</a>.NoMirroring 
- 无镜像</li>
<li><a href="qml-qtquick-shadereffectsource.html">ShaderEffectSource</a>.MirrorHorizontally 
- 生成的纹理沿 X 轴翻转。</li>
<li><a href="qml-qtquick-shadereffectsource.html">ShaderEffectSource</a>.MirrorVertically 
- 生成的纹理沿 Y 轴翻转。</li>
</ul>
<p>这个属性是在 Qt 5.6 中引入的。</p>
</div></div><!-- @@@layer.textureMirroring -->
<br/>
<!-- $$$layer.textureSize -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="layer.textureSize-prop">
<td class="tblQmlPropNode"><p>
<a name="layer.textureSize-prop"></a><span class="name">layer.textureSize</span> : <span class="type"><a href="../qtqml/qml-size.html">size</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此属性保存图层纹理的请求像素大小。如果它为空（默认值），则使用项的大小。</p>
<p><b>注意：</b>某些平台对帧缓冲区对象的大小有限制，这意味着实际纹理大小可能大于请求的大小。</p><p><b>请参考 </b><a href="qml-qtquick-item.html#item-layers">项层</a>.</p>
</div></div><!-- @@@layer.textureSize -->
<br/>
<!-- $$$layer.wrapMode -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="layer.wrapMode-prop">
<td class="tblQmlPropNode"><p>
<a name="layer.wrapMode-prop"></a><span class="name">layer.wrapMode</span> : <span class="type"><a href="../qtqml/qml-enumeration.html">enumeration</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此属性定义与纹理关联的 OpenGL 环绕模式。<i>在指定layer.effect</i>时修改此属性最有意义。</p>
<ul>
<li><a href="qml-qtquick-shadereffectsource.html">ShaderEffectSource</a>.ClampToEdge 
-水平和垂直的 GL_CLAMP_TO_EDGE</li>
<li><a href="qml-qtquick-shadereffectsource.html">ShaderEffectSource</a>.RepeatHorizontally 
- GL_REPEAT 水平，GL_CLAMP_TO_EDGE 垂直</li>
<li><a href="qml-qtquick-shadereffectsource.html">ShaderEffectSource</a>.RepeatVertically 
-&nbsp; GL_CLAMP_TO_EDGE 水平，GL_REPEAT 垂直</li>
<li><a href="qml-qtquick-shadereffectsource.html">ShaderEffectSource</a>.Repeat 
- 水平和垂直的 GL_REPEAT</li>
</ul>
<p><b>注意：</b>一些 OpenGL ES 2 实现不支持具有非二次幂纹理的 GL_REPEAT 环绕模式。</p><p><b>请参考 </b><a href="qml-qtquick-item.html#item-layers">项层</a>.</p>
</div></div><!-- @@@layer.wrapMode -->
<br/>
<!-- $$$opacity -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="opacity-prop">
<td class="tblQmlPropNode"><p>
<a name="opacity-prop"></a><span class="name">opacity</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此属性保存项的不透明度。不透明度指定为介于 0.0（完全透明）和 1.0（完全不透明）之间的数字。默认值为 1.0。</p>
<p>设置此属性时，指定的不透明度也将单独应用于子项。在某些情况下，这可能会产生意想不到的影响。例如，在下面的第二组矩形中，红色矩形指定的不透明度为 0.5，这会影响其蓝色子矩形的不透明度，即使子矩形没有指定不透明度。</p>
<div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><p class="centerAlign"><img src="images/declarative-item_opacity1.png" alt="" /></p></td><td ><pre class="qml">

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
      <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
          <span class="name">color</span>: <span class="string">&quot;red&quot;</span>
          <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
          <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
              <span class="name">color</span>: <span class="string">&quot;blue&quot;</span>
              <span class="name">x</span>: <span class="number">50</span>; <span class="name">y</span>: <span class="number">50</span>; <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
          }
      }
  }

</pre>
</td></tr>
<tr valign="top" class="even"><td ><p class="centerAlign"><img src="images/declarative-item_opacity2.png" alt="" /></p></td><td ><pre class="qml">

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
      <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
          <span class="name">opacity</span>: <span class="number">0.5</span>
          <span class="name">color</span>: <span class="string">&quot;red&quot;</span>
          <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
          <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
              <span class="name">color</span>: <span class="string">&quot;blue&quot;</span>
              <span class="name">x</span>: <span class="number">50</span>; <span class="name">y</span>: <span class="number">50</span>; <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
          }
      }
  }

</pre>
</td></tr>
</table></div>
<p>更改项的不透明度不会影响项是否接收用户输入事件。（相反，设置<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#visible-prop">visible</a>属性以<code>false</code>停止鼠标事件，设置<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#enabled-prop">enabled</a>属性以<code>false</code>停止鼠标和键盘事件，并从项中移除活动焦点。）</p>
<p><b>请参考 </b><a href="qml-qtquick-item.html#visible-prop">visible</a>。</p>
</div></div><!-- @@@opacity -->
<br/>
<!-- $$$parent -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="parent-prop">
<td class="tblQmlPropNode"><p>
<a name="parent-prop"></a><span class="name">parent</span> : <span class="type"><a href="qml-qtquick-item.html">Item</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此属性保存项的可视父项。</p>
<p><b>注意：</b><i>可视父项</i>的概念与<i><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtcore/qobject.html">QObject</a> parent</i>的概念不同。项的视觉父项不一定与其对象父项相同。有关更多详细信息，请参阅<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-visualcanvas-visualparent.html">概念 - Qt Quick 中的可视父级。</a></p></div></div><!-- @@@parent -->
<br/>
<!-- $$$resources -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="resources-prop">
<td class="tblQmlPropNode"><p>
<a name="resources-prop"></a><span class="name">resources</span> : <span class="type"><a href="../qtqml/qml-list.html">list</a></span>&lt;<span class="type">Object</span>&gt;</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>children 属性包含此项的可视子项列表。resources 属性包含要按名称引用的非可视资源。</p>
<p>添加子项或资源时，通常不需要引用这些属性，因为默认<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#data-prop">数据</a>属性会根据需要自动将子对象分配给<code>children</code>和<code>resources</code>属性。有关详细信息，请参阅<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#data-prop">数据</a>文档。</p>
</div></div><!-- @@@resources -->
<br/>
<!-- $$$rotation -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="rotation-prop">
<td class="tblQmlPropNode"><p>
<a name="rotation-prop"></a><span class="name">rotation</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此属性保存项围绕其<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#transformOrigin-prop">transformOrigin</a>顺时针旋转的度数。</p>
<p>默认值为 0 度（即不旋转）。</p>
<div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><p class="centerAlign"><img src="images/declarative-rotation.png" alt="" /></p></td><td ><pre class="qml">

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">color</span>: <span class="string">&quot;blue&quot;</span>
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
      <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
          <span class="name">color</span>: <span class="string">&quot;red&quot;</span>
          <span class="name">x</span>: <span class="number">25</span>; <span class="name">y</span>: <span class="number">25</span>; <span class="name">width</span>: <span class="number">50</span>; <span class="name">height</span>: <span class="number">50</span>
          <span class="name">rotation</span>: <span class="number">30</span>
      }
  }

</pre>
</td></tr>
</table></div>
<p><b>请参考 </b><a href="qml-qtquick-transform.html">Transform</a> 和 <a href="qml-qtquick-rotation.html">Rotation</a>。</p>
</div></div><!-- @@@rotation -->
<br/>
<!-- $$$scale -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="scale-prop">
<td class="tblQmlPropNode"><p>
<a name="scale-prop"></a><span class="name">scale</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此属性保存此项的比例因子。</p>
<p>小于 1.0 的比例会导致以较小的尺寸呈现项，而大于 1.0 的比例会以较大的尺寸呈现项。负比例会导致项在渲染时被镜像。</p>
<p>默认值为 1.0。</p>
<p>从<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#transformOrigin-prop">transformOrigin</a>应用缩放。</p>
<div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><p class="centerAlign"><img src="images/declarative-scale.png" alt="" /></p></td><td ><pre class="qml">

  import QtQuick 2.0

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">color</span>: <span class="string">&quot;blue&quot;</span>
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>

      <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
          <span class="name">color</span>: <span class="string">&quot;green&quot;</span>
          <span class="name">width</span>: <span class="number">25</span>; <span class="name">height</span>: <span class="number">25</span>
      }

      <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
          <span class="name">color</span>: <span class="string">&quot;red&quot;</span>
          <span class="name">x</span>: <span class="number">25</span>; <span class="name">y</span>: <span class="number">25</span>; <span class="name">width</span>: <span class="number">50</span>; <span class="name">height</span>: <span class="number">50</span>
          <span class="name">scale</span>: <span class="number">1.4</span>
      }
  }

</pre>
</td></tr>
</table></div>
<p><b>请参考 </b><a href="qml-qtquick-transform.html">Transform</a> 和 <a href="qml-qtquick-scale.html">Scale</a>。</p>
</div></div><!-- @@@scale -->
<br/>
<!-- $$$smooth -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="smooth-prop">
<td class="tblQmlPropNode"><p>
<a name="smooth-prop"></a><span class="name">smooth</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>主要用于基于图像的项，以决定项是否应该使用平滑采样。平滑采样使用线性插值执行，而非平滑采样使用最近邻执行。</p>
<p>在 Qt Quick 2.0 中，此属性对性能的影响很小。</p>
<p>默认情况下，此属性设置为<code>true</code>。</p>
</div></div><!-- @@@smooth -->
<br/>
<!-- $$$state -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="state-prop">
<td class="tblQmlPropNode"><p>
<a name="state-prop"></a><span class="name">state</span> : <span class="type"><a href="../qtqml/qml-string.html">string</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此属性保存项当前状态的名称。</p>
<p>如果项处于其默认状态，即未设置显式状态，则此属性包含一个空字符串。同样，您可以通过将此属性设置为空字符串来将项返回到其默认状态。</p>
<p><b>请参考 </b><a href="qtquick-statesanimations-states.html">Qt Quick 状态</a>。</p>
</div></div><!-- @@@state -->
<br/>
<!-- $$$states -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="states-prop">
<td class="tblQmlPropNode"><p>
<a name="states-prop"></a><span class="name">states</span> : <span class="type"><a href="../qtqml/qml-list.html">list</a></span>&lt;<span class="type"><a href="qml-qtquick-state.html">State</a></span>&gt;</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此属性保存此项的可能状态列表。要更改此项的状态，请将<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#state-prop">state</a>属性设置为这些状态之一，或将<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#state-prop">state</a>属性设置为空字符串以将项恢复为其默认状态。</p>
<p>此属性被指定为<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-state.html">State</a>对象的列表。例如，下面是具有“red_color”和“blue_color”状态的项：</p>
<pre class="qml">

  import QtQuick 2.0

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">id</span>: <span class="name">root</span>
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>

      <span class="name">states</span>: [
          <span class="type"><a href="qml-qtquick-state.html">State</a></span> {
              <span class="name">name</span>: <span class="string">&quot;red_color&quot;</span>
              <span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">root</span>; <span class="name">color</span>: <span class="string">&quot;red&quot;</span> }
          },
          <span class="type"><a href="qml-qtquick-state.html">State</a></span> {
              <span class="name">name</span>: <span class="string">&quot;blue_color&quot;</span>
              <span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">root</span>; <span class="name">color</span>: <span class="string">&quot;blue&quot;</span> }
          }
      ]
  }

</pre>
<p>有关使用状态和转换的更多详细信息，请参阅<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-statesanimations-states.html">Qt Quic状态</a>和<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-statesanimations-animations.html">Qt Quick 中的动画和转换。</a></p>
<p><b>请参考 </b><a href="qtquick-statesanimations-topic.html#transitions">transitions</a>。</p>
</div></div><!-- @@@states -->
<br/>
<!-- $$$transform -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="transform-prop">
<td class="tblQmlPropNode"><p>
<a name="transform-prop"></a><span class="name">transform</span> : <span class="type"><a href="../qtqml/qml-list.html">list</a></span>&lt;<span class="type"><a href="qml-qtquick-transform.html">Transform</a></span>&gt;</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此属性包含要应用的转换列表。</p>
<p>有关详细信息，请参阅<a href="qml-qtquick-transform.html">Transform</a>。</p>
</div></div><!-- @@@transform -->
<br/>
<!-- $$$transformOrigin -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="transformOrigin-prop">
<td class="tblQmlPropNode"><p>
<a name="transformOrigin-prop"></a><span class="name">transformOrigin</span> : <span class="type"><a href="../qtqml/qml-enumeration.html">enumeration</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此属性保存缩放和旋转变换所围绕的原点。</p>
<p>有九个变换原点可用，如下图所示。默认变换原点是<code>Item.Center</code>.</p>
<p class="centerAlign"><img src="images/declarative-transformorigin.png" alt="" /></p><p>此示例围绕其右下角旋转图像。</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-image.html">Image</a></span> {
      <span class="name">source</span>: <span class="string">&quot;myimage.png&quot;</span>
      <span class="name">transformOrigin</span>: <span class="name">Item</span>.<span class="name">BottomRight</span>
      <span class="name">rotation</span>: <span class="number">45</span>
  }

</pre>
<p>要设置任意变换原点，请使用带有<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#transform-prop">transform的</a><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-scale.html">Scale</a>或<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-rotation.html">Rotation</a>变换类型。<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#transform-prop"></a></p>
</div></div><!-- @@@transformOrigin -->
<br/>
<!-- $$$transitions -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="transitions-prop">
<td class="tblQmlPropNode"><p>
<a name="transitions-prop"></a><span class="name">transitions</span> : <span class="type"><a href="../qtqml/qml-list.html">list</a></span>&lt;<span class="type"><a href="qml-qtquick-transition.html">Transition</a></span>&gt;</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此属性保存此项的转换列表。这些定义了当它改变它的<a href="qml-qtquick-item.html#state-prop">状态</a>时应用到它的转换。</p>
<p>&nbsp;该属性被指定为一个<a href="qmlexampletoggleswitch.html#transition">Transition</a>对象的列表。例如：</p>
<pre class="qml">

  import QtQuick 2.0

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
      <span class="name">transitions</span>: [
          <span class="type"><a href="qml-qtquick-transition.html">Transition</a></span> {
              <span class="comment">//...</span>
          },
          <span class="type"><a href="qml-qtquick-transition.html">Transition</a></span> {
              <span class="comment">//...</span>
          }
      ]
  }

</pre>
<p>有关使用状态和转换的更多详细信息，请参阅<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-statesanimations-states.html">Qt Quick</a>状态和<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-statesanimations-animations.html">Qt Quick 中的动画和转换。</a></p>
<p><b>请参考 </b><a href="qtquick-statesanimations-topic.html#states">states</a>。</p>
</div></div><!-- @@@transitions -->
<br/>
<!-- $$$visible -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="visible-prop">
<td class="tblQmlPropNode"><p>
<a name="visible-prop"></a><span class="name">visible</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此属性保存项是否可见。默认情况下这是true。</p>
<p>
设置此属性将直接影响子项的可见值。当设置为false时，所有子项的可见值也变为false。当设置为true时，子项的可见值将返回true，除非它们被显式地设置为false。</p>
<p>（由于这种流动行为，<code>visible</code>如果属性绑定应该只响应显式属性更改，则使用该属性可能不会产生预期的效果。在这种情况下，使用<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-effects-topic.html#opacity">opacity</a>属性可能会更好。）</p>
<p>如果此属性设置为<code>false</code>，则该项将不再接收鼠标事件，但将继续接收按键事件，并且如果已设置，将保留键盘<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#focus-prop">焦点。</a>（相反，将<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#enabled-prop">enabled</a>属性设置为<code>false</code>停止鼠标和键盘事件，并从项中移除焦点。）</p>
<p><b>注意：</b>此属性的值仅受更改此属性或父<code>visible</code>属性的影响。<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qtquick-effects-topic.html#opacity">例如，如果此项移出屏幕，或者不透明度</a>更改为 0 ，则它不会更改。</p><p><b>请参考 </b><a href="qtquick-effects-topic.html#opacity">opacity</a> 和 <a href="qml-qtquick-item.html#enabled-prop">enabled</a>。</p>
</div></div><!-- @@@visible -->
<br/>
<!-- $$$visibleChildren -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="visibleChildren-prop">
<td class="tblQmlPropNode"><p>
<a name="visibleChildren-prop"></a><span class="name">visibleChildren</span> : <span class="type"><a href="../qtqml/qml-list.html">list</a></span>&lt;<span class="type"><a href="qml-qtquick-item.html">Item</a></span>&gt;</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>此只读属性列出了当前可见的所有项的子项。请注意，孩子的可见性可能已显式更改，或者因为此（它的父）项或另一个祖父母的可见性发生了变化。</p>
</div></div><!-- @@@visibleChildren -->
<br/>
<!-- $$$width -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="width-prop">
<td class="tblQmlPropNode"><p>
<a name="width-prop"></a><span class="name">width</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>定义项的位置和大小。默认值为<code>0</code>。</p>
<p>(x,y) 位置是相对于<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#parent-prop">parent</a>的。</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> { <span class="name">x</span>: <span class="number">100</span>; <span class="name">y</span>: <span class="number">100</span>; <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span> }

</pre>
</div></div><!-- @@@width -->
<br/>
<!-- $$$x -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="x-prop">
<td class="tblQmlPropNode"><p>
<a name="x-prop"></a><span class="name">x</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>定义项的位置和大小。默认值为<code>0</code>。</p>
<p>(x,y) 位置是相对于<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#parent-prop">parent</a>的。</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> { <span class="name">x</span>: <span class="number">100</span>; <span class="name">y</span>: <span class="number">100</span>; <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span> }

</pre>
</div></div><!-- @@@x -->
<br/>
<!-- $$$y -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="y-prop">
<td class="tblQmlPropNode"><p>
<a name="y-prop"></a><span class="name">y</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>定义项的位置和大小。默认值为<code>0</code>。</p>
<p>(x,y) 位置是相对于<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#parent-prop">parent</a>的。</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> { <span class="name">x</span>: <span class="number">100</span>; <span class="name">y</span>: <span class="number">100</span>; <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span> }

</pre>
</div></div><!-- @@@y -->
<br/>
<!-- $$$z -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="z-prop">
<td class="tblQmlPropNode"><p>
<a name="z-prop"></a><span class="name">z</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>设置同级项的堆叠顺序。默认情况下，堆叠顺序为 0。</p>
<p>具有较高堆叠值的项被绘制在具有较低堆叠顺序的同级之上。具有相同堆叠值的项按照它们出现的顺序自下而上绘制。具有负堆叠值的项被绘制在其父项的内容下。</p>
<p>以下示例显示了堆叠顺序的各种效果。</p>
<div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><p class="centerAlign"><img src="images/declarative-item_stacking1.png" alt="" /></p></td><td >相同<code>z</code>- 较早的孩子高于较晚的孩子：<pre class="qml">

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
      <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
          <span class="name">color</span>: <span class="string">&quot;red&quot;</span>
          <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
      }
      <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
          <span class="name">color</span>: <span class="string">&quot;blue&quot;</span>
          <span class="name">x</span>: <span class="number">50</span>; <span class="name">y</span>: <span class="number">50</span>; <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
      }
  }

</pre>
</td></tr>
<tr valign="top" class="even"><td ><p class="centerAlign"><img src="images/declarative-item_stacking2.png" alt="" /></p></td><td ><code>z</code>顶部更高：<pre class="qml">

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
      <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
          <span class="name">z</span>: <span class="number">1</span>
          <span class="name">color</span>: <span class="string">&quot;red&quot;</span>
          <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
      }
      <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
          <span class="name">color</span>: <span class="string">&quot;blue&quot;</span>
          <span class="name">x</span>: <span class="number">50</span>; <span class="name">y</span>: <span class="number">50</span>; <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
      }
  }

</pre>
</td></tr>
<tr valign="top" class="odd"><td ><p class="centerAlign"><img src="images/declarative-item_stacking3.png" alt="" /></p></td><td >相同<code>z</code>- 父母以上的孩子：<pre class="qml">

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
      <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
          <span class="name">color</span>: <span class="string">&quot;red&quot;</span>
          <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
          <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
              <span class="name">color</span>: <span class="string">&quot;blue&quot;</span>
              <span class="name">x</span>: <span class="number">50</span>; <span class="name">y</span>: <span class="number">50</span>; <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
          }
      }
  }

</pre>
</td></tr>
<tr valign="top" class="even"><td ><p class="centerAlign"><img src="images/declarative-item_stacking4.png" alt="" /></p></td><td >低于<code>z</code>：<pre class="qml">

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
      <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
          <span class="name">color</span>: <span class="string">&quot;red&quot;</span>
          <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
          <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
              <span class="name">z</span>: -<span class="number">1</span>
              <span class="name">color</span>: <span class="string">&quot;blue&quot;</span>
              <span class="name">x</span>: <span class="number">50</span>; <span class="name">y</span>: <span class="number">50</span>; <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
          }
      }
  }

</pre>
</td></tr>
</table></div>
</div></div><!-- @@@z -->
<br/>
<h2>方法文档</h2>
<!-- $$$ -->
<div class="qmlitem"><div class="fngroup">
<div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="">
<td class="tblQmlFuncNode"><p>
<a name="mapToItem-method"></a><span class="type">object</span> <span class="name">mapToItem</span>(<span class="type"><a href="qml-qtquick-item.html">Item</a></span> <i>item</i>,  <span class="type"><a href="../qtqml/qml-real.html">real</a></span> <i>x</i>,  <span class="type"><a href="../qtqml/qml-real.html">real</a></span> <i>y</i>)</p></td></tr>
<tr valign="top" class="odd" id="">
<td class="tblQmlFuncNode"><p>
<a name="mapToItem-method-1"></a><span class="type">object</span> <span class="name">mapToItem</span>(<span class="type"><a href="qml-qtquick-item.html">Item</a></span> <i>item</i>,  <span class="type"><a href="../qtqml/qml-real.html">real</a></span> <i>x</i>,  <span class="type"><a href="../qtqml/qml-real.html">real</a></span> <i>y</i>,  <span class="type"><a href="../qtqml/qml-real.html">real</a></span> <i>width</i>,  <span class="type"><a href="../qtqml/qml-real.html">real</a></span> <i>height</i>)</p></td></tr>
</table></div>
</div></div><div class="qmldoc"><p>将 item 的坐标系中的点 ( <i>x</i> , <i>y</i> ) 或 rect ( <i>x</i> , <i>y</i> , <i>width</i> , <i>height</i> ) 映射到<i>item</i>的坐标系，并返回与映射坐标匹配的<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtqml/qml-point.html">点</a>或<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtqml/qml-rect.html">矩形。</a></p>
<p>映射中使用了项的以下属性：<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#x-prop">x</a>、<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#y-prop">y</a>、<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#scale-prop">scale</a>、<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#rotation-prop">rotation</a>、<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#transformOrigin-prop">transformOrigin</a>和<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#transform-prop">transform</a>。</p>
<p>如果<i>item</i>是一个<code>null</code>值，这会将点或矩形映射到根 QML 视图的坐标系。</p>
</div></div><!-- @@@ -->
<br/>
<!-- $$$ -->
<div class="qmlitem"><div class="fngroup">
<div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="">
<td class="tblQmlFuncNode"><p>
<a name="mapFromItem-method"></a><span class="type">object</span> <span class="name">mapFromItem</span>(<span class="type"><a href="qml-qtquick-item.html">Item</a></span> <i>item</i>,  <span class="type"><a href="../qtqml/qml-real.html">real</a></span> <i>x</i>,  <span class="type"><a href="../qtqml/qml-real.html">real</a></span> <i>y</i>)</p></td></tr>
<tr valign="top" class="odd" id="">
<td class="tblQmlFuncNode"><p>
<a name="mapFromItem-method-1"></a><span class="type">object</span> <span class="name">mapFromItem</span>(<span class="type"><a href="qml-qtquick-item.html">Item</a></span> <i>item</i>,  <span class="type"><a href="../qtqml/qml-real.html">real</a></span> <i>x</i>,  <span class="type"><a href="../qtqml/qml-real.html">real</a></span> <i>y</i>,  <span class="type"><a href="../qtqml/qml-real.html">real</a></span> <i>width</i>,  <span class="type"><a href="../qtqml/qml-real.html">real</a></span> <i>height</i>)</p></td></tr>
</table></div>
</div></div><div class="qmldoc"><p><i>将item</i>坐标系中的点 ( <i>x</i> , <i>y</i> ) 或 rect ( <i>x</i> , <i>y</i> , <i>width</i> , <i>height</i> )映射到该项的坐标系，并返回与映射坐标匹配的<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtqml/qml-point.html">点</a>或<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtqml/qml-rect.html">矩形。</a><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtqml/qml-point.html"></a><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtqml/qml-rect.html"></a></p>
<p>映射中使用了项的以下属性：<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#x-prop">x</a>、<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#y-prop">y</a>、<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#scale-prop">scale</a>、<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#rotation-prop">rotation</a>、<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#transformOrigin-prop">transformOrigin</a>和<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#transform-prop">transform</a>。</p>
<p>如果<i>item</i>是一个<code>null</code>值，则从根 QML 视图的坐标系映射点或矩形。</p>
</div></div><!-- @@@ -->
<br/>
<!-- $$$childAt -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="childAt-method">
<td class="tblQmlFuncNode"><p>
<a name="childAt-method"></a><span class="name">childAt</span>(<span class="type"><a href="../qtqml/qml-real.html">real</a></span> <i>x</i>,  <span class="type"><a href="../qtqml/qml-real.html">real</a></span> <i>y</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回在该项的坐标系内的点(<i>x</i>, <i>y</i>) 处找到的第一个可见子项。</p>
<p>如果没有这样的项，则返回<code>null</code> 。</p>
</div></div><!-- @@@childAt -->
<br/>
<!-- $$$contains -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="contains-method">
<td class="tblQmlFuncNode"><p>
<a name="contains-method"></a><span class="type"><a href="../qtqml/qml-bool.html">bool</a></span> <span class="name">contains</span>(<span class="type"><a href="../qtqml/qml-point.html">point</a></span> <i>point</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>如果此项包含<i>point</i>，则返回 true，点位于本地坐标中；否则返回 false。</p>
</div></div><!-- @@@contains -->
<br/>
<!-- $$$forceActiveFocus -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="forceActiveFocus-method">
<td class="tblQmlFuncNode"><p>
<a name="forceActiveFocus-method"></a><span class="name">forceActiveFocus</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>强制将焦点集中在项上。</p>
<p>此方法将焦点设置在项上，并确保对象层次结构中的所有祖先<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-focusscope.html">FocusScope</a>对象也被赋予<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#focus-prop">焦点</a>。</p>
<p>焦点更改的原因将是<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtcore/qt.html#FocusReason-enum">Qt::OtherFocusReason</a>。使用重载方法指定焦点原因，以便更好地处理焦点更改。</p>
<p><b>请参考 </b><a href="qml-qtquick-item.html#activeFocus-prop">activeFocus</a>。</p>
</div></div><!-- @@@forceActiveFocus -->
<br/>
<!-- $$$forceActiveFocus -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="forceActiveFocus-method-1">
<td class="tblQmlFuncNode"><p>
<a name="forceActiveFocus-method-1"></a><span class="name">forceActiveFocus</span>(<span class="type">Qt::FocusReason</span> <i>reason</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>这是一个重载函数。</p>
<p>以给定的<i>reason</i>强制将注意力集中在项上。</p>
<p>此方法将焦点设置在项上，并确保对象层次结构中的所有祖先<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-focusscope.html">FocusScope</a>对象也被赋予<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#focus-prop">焦点</a>。</p>
<p>这种方法是在 Qt 5.1 中引入的。</p>
<p><b>请参考 </b><a href="qml-qtquick-item.html#activeFocus-prop">activeFocus</a> 和 <a href="../qtcore/qt.html#FocusReason-enum">Qt::FocusReason</a>。</p>
</div></div><!-- @@@forceActiveFocus -->
<br/>
<!-- $$$grabToImage -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="grabToImage-method">
<td class="tblQmlFuncNode"><p>
<a name="grabToImage-method"></a><span class="type"><a href="../qtqml/qml-bool.html">bool</a></span> <span class="name">grabToImage</span>(<i>callback</i>, <i>targetSize</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>将项抓取到内存中的图像中。</p>
<p>抓取是异步发生的，抓取完成时会调用 JavaScript 函数<i>callback</i>。回调接受一个参数，即抓取操作的结果；一个<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-itemgrabresult.html">ItemGrabResult</a>对象。</p>
<p>使用<i>targetSize</i>指定目标图像的大小。默认情况下，结果将与项具有相同的大小。</p>
<p>如果无法启动抓取，则函数返回<code>false</code>。</p>
<p>下面的代码片段展示了如何抓取一个项并将结果存储到一个文件中。</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">id</span>: <span class="name">source</span>
      <span class="name">width</span>: <span class="number">100</span>
      <span class="name">height</span>: <span class="number">100</span>
      <span class="name">gradient</span>: <span class="name">Gradient</span> {
          <span class="type"><a href="qml-qtquick-gradientstop.html">GradientStop</a></span> { <span class="name">position</span>: <span class="number">0</span>; <span class="name">color</span>: <span class="string">&quot;steelblue&quot;</span> }
          <span class="type"><a href="qml-qtquick-gradientstop.html">GradientStop</a></span> { <span class="name">position</span>: <span class="number">1</span>; <span class="name">color</span>: <span class="string">&quot;black&quot;</span> }
      }
  }
      <span class="comment">// ...</span>
      <span class="name">source</span>.<span class="name">grabToImage</span>(<span class="keyword">function</span>(result) {
                             <span class="name">result</span>.<span class="name">saveToFile</span>(<span class="string">&quot;something.png&quot;</span>);
                         });

</pre>
<p>下面的代码片段展示了如何抓取一个项并在另一个图像元素中使用结果。</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-image.html">Image</a></span> {
      <span class="name">id</span>: <span class="name">image</span>
  }
      <span class="comment">// ...</span>
      <span class="name">source</span>.<span class="name">grabToImage</span>(<span class="keyword">function</span>(result) {
                             <span class="name">image</span>.<span class="name">source</span> <span class="operator">=</span> <span class="name">result</span>.<span class="name">url</span>;
                         },
                         <span class="name">Qt</span>.<span class="name">size</span>(<span class="number">50</span>, <span class="number">50</span>));

</pre>
<p><b>注意：</b>此函数会将项渲染到屏幕外表面并将该表面从 GPU 的内存复制到 CPU 的内存中，这可能会非常昂贵。对于“实时”预览，请使用<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#layer.enabled-prop">图层</a>或<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-shadereffectsource.html">ShaderEffectSource</a>。</p></div></div><!-- @@@grabToImage -->
<br/>
<!-- $$$mapFromGlobal -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="mapFromGlobal-method">
<td class="tblQmlFuncNode"><p>
<a name="mapFromGlobal-method"></a><span class="type">object</span> <span class="name">mapFromGlobal</span>(<span class="type"><a href="../qtqml/qml-real.html">real</a></span> <i>x</i>,  <span class="type"><a href="../qtqml/qml-real.html">real</a></span> <i>y</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>将全局坐标系中的点 ( <i>x</i> , <i>y</i> ) 映射到项的坐标系，并返回与映射坐标匹配的<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtqml/qml-point.html">点。</a></p>
<p>映射中使用了项的以下属性：<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#x-prop">x</a>、<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#y-prop">y</a>、<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#scale-prop">scale</a>、<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#rotation-prop">rotation</a>、<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#transformOrigin-prop">transformOrigin</a>和<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#transform-prop">transform</a>。</p>
<p>这种方法是在 Qt 5.7 中引入的。</p>
</div></div><!-- @@@mapFromGlobal -->
<br/>
<!-- $$$mapToGlobal -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="mapToGlobal-method">
<td class="tblQmlFuncNode"><p>
<a name="mapToGlobal-method"></a><span class="type">object</span> <span class="name">mapToGlobal</span>(<span class="type"><a href="../qtqml/qml-real.html">real</a></span> <i>x</i>,  <span class="type"><a href="../qtqml/qml-real.html">real</a></span> <i>y</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>将位于此项坐标系中的点 (<i>x</i>, <i>y</i>)映射到全局坐标系，并返回与映射坐标匹配的<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtqml/qml-point.html">点。</a></p>
<p>映射中使用了项的以下属性：<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#x-prop">x</a>、<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#y-prop">y</a>、<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#scale-prop">scale</a>、<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#rotation-prop">rotation</a>、<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#transformOrigin-prop">transformOrigin</a>和<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtquick/qml-qtquick-item.html#transform-prop">transform</a>。</p>
<p>这种方法是在 Qt 5.7 中引入的。</p>
</div></div><!-- @@@mapToGlobal -->
<br/>
<!-- $$$nextItemInFocusChain -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="nextItemInFocusChain-method">
<td class="tblQmlFuncNode"><p>
<a name="nextItemInFocusChain-method"></a><span class="name">nextItemInFocusChain</span>(<span class="type"><a href="../qtqml/qml-bool.html">bool</a></span> <i>forward</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>返回焦点链中与该项相邻的项。如果<i>forward</i>是<code>true</code>或未提供，则它是 forwards 方向的下一个项。如果<i>forward</i>是<code>false</code>，则它是向后方向的下一个项。</p>
<p>这种方法是在 Qt 5.1 中引入的。</p>
</div></div><!-- @@@nextItemInFocusChain -->
<br/>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
